/*
 * create:2016年4月5日 上午10:59:46
 * author:wangds  
 */
package com.cxkj.shop.biz.user;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import com.cxkj.shop.model.shoppingcart.ShoppingCart;
import com.cxkj.shop.model.user.GegewuUser;
import com.cxkj.shop.model.user.User;
import com.cxkj.shop.utils.BusinessUtils;
import com.cxkj.shop.utils.UserUtils;

import net.wangds.comp.business.http.AbstractBaseHttpInteractionBusiness;

/**
 * 支付申请.
 * @author wangds
 *
 */
public class UpdateUserBaseInfoBusiness extends AbstractBaseHttpInteractionBusiness<Map<String,Object>, Boolean> {

  /*
   * @see net.wangds.comp.business.http.AbstractBaseHttpInteractionBusiness#process(java.lang.Object)
   * @author wangds 2016年8月11日 上午9:33:56.
   */
  @Override
  protected Boolean process(Map<String, Object> input) throws Exception {
    
    String phone=String.valueOf(input.get("phone"));
    String nickname=String.valueOf(input.get("nickname"));
    String openId = BusinessUtils.getOpenIdSession(BusinessUtils.getHttpSessionFromHttpBusiness(this));
    
    Map<String,Object> param = new HashMap<String,Object>();
    param.put("phone", phone);
    param.put("nickname", nickname);
    param.put("openId", openId);
    HttpSession session = BusinessUtils.getHttpSessionFromHttpBusiness(this);
    /*Map<String, Object> user = BusinessUtils.getUserInfoFromSession(session);
    user.put("nickname", nickname);
    user.put("phone",phone);*/
    ShoppingCart cart = BusinessUtils.getShoppingCartFromSession(session);
    User cartUser = cart.getUser();
    cartUser.setNickname(nickname);
    GegewuUser guser=(GegewuUser)cartUser;
    guser.setPhone(phone);
    return UserUtils.updateUserBaseInfo(param);
  }



}
